﻿using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;

namespace zframe.editor {
    public class AssetFileUtils
    {
        public static string[] GetFilesBySelect(UnityEngine.Object selectObj, string[] exts) {
            string relativePath = AssetDatabase.GetAssetPath(selectObj);
            string[] files = FileUtils.GetFilesByExts(relativePath, exts);
            return files;

        }

        public static string GetSelectFolder()
        {
            UnityEngine.Object selctObj = Selection.activeObject;
            if (selctObj == null)
            {
                return "";
            }
            string relativePath = AssetDatabase.GetAssetPath(selctObj);

            if (Path.HasExtension(relativePath)) //选中的是文件
            {
                relativePath = Path.GetDirectoryName(relativePath);
            }
            return relativePath;
        }

    }
}


